package rentadomus

class OfficeController {

    //def index() { }
    def scaffold = Office
    def save() {
        def officeInstance = new Office(params)
        def placeInstance = new Place(params)
        placeInstance.idPerson = session.person
        officeInstance.idPlace = placeInstance
        if (placeInstance.save(flush: true)) {
            if (!officeInstance.save(flush: true)) {
                render(view: "create", model: [localInstance: localInstance])
                return
            }
        }
        redirect(controller:"uploadImage", action: "main", id: placeInstance.id)
    }
}

